unit URadiologyTestResult;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ExtCtrls, AdvPanel, cxGraphics,
  cxControls, cxLookAndFeels, cxLookAndFeelPainters, cxContainer, cxEdit,
  dxSkinsCore, dxSkinBlack, dxSkinBlue, dxSkinBlueprint, dxSkinCaramel,
  dxSkinCoffee, dxSkinDarkRoom, dxSkinDarkSide, dxSkinDevExpressDarkStyle,
  dxSkinDevExpressStyle, dxSkinFoggy, dxSkinGlassOceans, dxSkinHighContrast,
  dxSkiniMaginary, dxSkinLilian, dxSkinLiquidSky, dxSkinLondonLiquidSky,
  dxSkinMcSkin, dxSkinMoneyTwins, dxSkinOffice2007Black, dxSkinOffice2007Blue,
  dxSkinOffice2007Green, dxSkinOffice2007Pink, dxSkinOffice2007Silver,
  dxSkinOffice2010Black, dxSkinOffice2010Blue, dxSkinOffice2010Silver,
  dxSkinPumpkin, dxSkinSeven, dxSkinSevenClassic, dxSkinSharp, dxSkinSharpPlus,
  dxSkinSilver, dxSkinSpringTime, dxSkinStardust, dxSkinSummer2008,
  dxSkinTheAsphaltWorld, dxSkinsDefaultPainters, dxSkinValentine, dxSkinVS2010,
  dxSkinWhiteprint, dxSkinXmas2008Blue, cxGroupBox, DBAdvGlowNavigator,
  cxStyles, dxSkinscxPCPainter, cxCustomData, cxFilter, cxData, cxDataStorage,
  cxNavigator, Data.DB, cxDBData, cxGridLevel, cxClasses, cxGridCustomView,
  cxGridCustomTableView, cxGridTableView, cxGridDBTableView, cxGrid, UDMLab, UDMPerson,
  cxTextEdit, cxMaskEdit, cxDropDownEdit, cxLookupEdit, cxDBLookupEdit,
  cxDBLookupComboBox, Vcl.StdCtrls, cxCalendar, cxDBEdit, cxSpinEdit, cxTimeEdit,
  cxMemo, Vcl.Menus, cxButtons, URadiologyRequestSub, RzBorder, cxRichEdit,
  cxDBRichEdit, AdvScrollBox, Vcl.CategoryButtons, Vcl.ButtonGroup,
  Vcl.ComCtrls, Vcl.ToolWin, LMDRTFRichEdit, LMDRTFDBRichEdit, LMDRTFActions,
  System.Actions, Vcl.ActnList, Vcl.ImgList, Vcl.ActnMan, Vcl.ActnCtrls,
  Vcl.PlatformDefaultStyleActnCtrls, LMDControl, LMDCustomControl,
  LMDCustomPanel, LMDCustomBevelPanel, LMDBaseEdit, LMDCustomMemo, LMDDBMemo,
  LMDRTFFontComboBox, LMDRTFBase, LMDCustomComponent, LMDTaskDlg,
  Datasnap.DSHTTP, LMDRTFStorage;

type
  TFRadiologyTestResult = class(TForm)
    AdvPanel1: TAdvPanel;
    AdvPanelStyler1: TAdvPanelStyler;
    cxGroupBox1: TcxGroupBox;
    AdvPanel2: TAdvPanel;
    Label1: TLabel;
    cxDBLookupComboBox1: TcxDBLookupComboBox;
    Label2: TLabel;
    cxDBDateEdit1: TcxDBDateEdit;
    Label5: TLabel;
    Label4: TLabel;
    cxDBTextEdit1: TcxDBTextEdit;
    RzBorder1: TRzBorder;
    AdvPanel3: TAdvPanel;
    AdvPanelStyler2: TAdvPanelStyler;
    RzBorder2: TRzBorder;
    AdvPanel4: TAdvPanel;
    Label6: TLabel;
    cxLookupComboBox1: TcxLookupComboBox;
    cxButton1: TcxButton;
    ButtonGroup1: TButtonGroup;
    LMDRichEdit: TLMDRichEdit;
    ImageList: TImageList;
    alToolbar: TActionList;
    Toolbar: TToolBar;
    btnCut: TToolButton;
    actCut: TLMDRichEditCut;
    btnCopy: TToolButton;
    actCopy: TLMDRichEditCopy;
    btnPaste: TToolButton;
    actPaste: TLMDRichEditPaste;
    btnUndo: TToolButton;
    actUndo: TLMDRichEditUndo;
    btnRedo: TToolButton;
    actRedo: TLMDRichEditRedo;
    btnTextAttributes: TToolButton;
    actTextAttributes: TLMDRichEditTextAttributes;
    btnTextBold: TToolButton;
    actTextBold: TLMDRichEditTextBold;
    btnTextItalic: TToolButton;
    actTextItalic: TLMDRichEditTextItalic;
    btnTextUnderline: TToolButton;
    actTextUnderline: TLMDRichEditTextUnderline;
    btnTextSubscript: TToolButton;
    actTextSubscript: TLMDRichEditTextSubscript;
    btnTextSuperscript: TToolButton;
    actTextSuperscript: TLMDRichEditTextSuperscript;
    btnParaAlignLeft: TToolButton;
    actParaAlignLeft: TLMDRichEditParaAlignLeft;
    btnParaAlignCenter: TToolButton;
    actParaAlignCenter: TLMDRichEditParaAlignCenter;
    btnParaAlignRight: TToolButton;
    actParaAlignRight: TLMDRichEditParaAlignRight;
    btnNumberingBullet: TToolButton;
    actNumberingBullet: TLMDRichEditNumberingBullet;
    btnNumberingArabicNumbers: TToolButton;
    actNumberingArabicNumbers: TLMDRichEditNumberingArabicNumbers;
    btnIndent: TToolButton;
    actIndent: TLMDRichEditIndent;
    btnUnindent: TToolButton;
    actUnindent: TLMDRichEditUnindent;
    ToolBar1: TToolBar;
    LMDFontComboBox1: TLMDRichFontComboBox;
    LMDFontSizeComboBox1: TLMDRichFontSizeComboBox;
    LMDTaskDialog1: TLMDTaskDialog;
    Button1: TButton;
    LMDRichStorage1: TLMDRichStorage;
    cxDBTextEdit3: TcxDBTextEdit;
    Label3: TLabel;
    Label7: TLabel;
    cxDBLookupComboBox2: TcxDBLookupComboBox;
    cxDBTextEdit2: TcxDBTextEdit;
    Label8: TLabel;
    procedure cxLookupComboBox1PropertiesEditValueChanged(Sender: TObject);
    procedure cxButton1Click(Sender: TObject);
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  FRadiologyTestResult: TFRadiologyTestResult;

implementation

{$R *.dfm}

procedure TFRadiologyTestResult.Button1Click(Sender: TObject);
begin
//  Self.LMDRichEdit.RichStorageItem := 0;

end;

procedure TFRadiologyTestResult.cxButton1Click(Sender: TObject);
begin

  DMLab.his_test_request_radio_sub.Edit;
  DMLab.his_test_request_radio_sub.FieldByName('result').Value := Self.LMDRichEdit.RTFText;
  DMLab.his_test_request_radio_sub.Post;
  DMLab.his_test_request_radio_sub.RefreshRecord;
  ShowMessage('Result Added');
end;

procedure TFRadiologyTestResult.cxLookupComboBox1PropertiesEditValueChanged(
  Sender: TObject);
  var
    subBatchNR : Integer;
    itemID : Integer;
begin
  DMLab.his_test_request_radio_sub.Edit;
  Self.LMDRichEdit.Enabled := True;
  subBatchNR := Self.cxLookupComboBox1.EditValue;
  DMLab.his_test_request_radio_sub.Locate('his_test_request_radio_sub_id',subBatchNR,[loPartialKey]);
  Self.LMDRichEdit.RTFText := DMLab.his_test_request_radio_sub.FieldByName('result').Value;
end;

end.
